/**
 * 
 */
package com.flymobi.util;


import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * @author Administrator
 *
 */
public class WeatherUtil {
	protected static Log log = LogFactory.getLog(WeatherUtil.class);
	/*public static Weather get(String ip){
		Weather w=null;
		String cityCode="101010100";
		IpLocation ipLoc= SM.IpLocationService.find(ip);
		log.info("ip:"+ip+"city:"+ipLoc.getCity());
		CityCode c=SM.CityCodeService.find(ipLoc.getCity());
		if(c!=null){
			cityCode=c.getCode();
		}
		//log.info("ip:"+ip+"city:"+ipLoc.getCity()+"code:"+cityCode);
		try {
			w=(Weather)SM.CacheOscache.getFromCache("weather", cityCode, 60*30);
		} catch (CacheNeedsRefreshException e) {
			w=new Weather();
			String url="http://www.weather.com.cn/data/cityinfo/"+cityCode+".html";
			JSONObject jo=JsonHttpClient.get(url);
			w.setCity(jo.getJSONObject("weatherinfo").getString("city"));
			w.setMaxTemp(jo.getJSONObject("weatherinfo").getString("temp1"));
			w.setMinTemp(jo.getJSONObject("weatherinfo").getString("temp2"));
			w.setWeather(jo.getJSONObject("weatherinfo").getString("weather"));
			w.setImg("http://m.weather.com.cn/img/"+jo.getJSONObject("weatherinfo").getString("img1"));
			SM.CacheOscache.putInCache("weather", cityCode, w);
		}
		return w;
	}*/
}